package com.why.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.why.mapper.UserMapper;
import com.why.pojo.User;
import com.why.pojo.UserVo;
import com.why.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author new wei
 * @date 2022/5/19 22:09
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public PageInfo<User> list(Integer pageNum, Integer pageSize, UserVo vo) {
        PageHelper.startPage(pageNum,pageSize);
        List<User> list=userMapper.list(vo);
        PageInfo<User> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public void update(User user) {
        userMapper.update(user);
    }

    @Override
    public int del(int id) {
        return userMapper.del(id);
    }

    @Override
    public User getUser(int id) {
        return userMapper.getUser(id);
    }
}
